//
//  CDPullToLoadView.m
//  CuriosityDaily3
//
//  Created by JSY on 16/9/25.
//  Copyright © 2016年 theBestTeam. All rights reserved.
//

#import "CDPullToLoadView.h"

@implementation CDPullToLoadView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setupUI];
    }
    return self;
}

-(void)setupUI{
    UIImageView *imageView = [[UIImageView alloc] init];
//    imageView.image = [UIImage imageNamed:@"list_loading_014.png"];
    [self addSubview:imageView];
    imageView.image = [UIImage animatedImageWithImages:[self loadImages] duration:1.0];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.offset(0);
    }];
}

//包装动画图片
-(NSArray *)loadImages{
    NSMutableArray *Marray = [NSMutableArray array];
    for (NSInteger i = 1; i < 21; i++) {
        NSString *str = [NSString stringWithFormat:@"list_loading_0%02zd.png",i];
        UIImage *image = [UIImage imageNamed:str];
        [Marray addObject:image];
    }
    return Marray.copy;
}

@end
